import { defineStore } from "pinia";
import { LayoutState } from "@/stores/interface/layout";

export const useLayoutStore = defineStore("layout", {
  state: (): LayoutState => {
    return {
      layoutCurrent: "Default",
      isCollapse: false, //侧边栏是否收起
      accordion: false //是否开启手风琴
    };
  },
  getters: {
    layoutCurrentGet: state => state.layoutCurrent,
    isCollapseGet: state => state.isCollapse,
    accordionGet: state => state.accordion
  },
  actions: {
    setLayoutState(...args: ObjToKeyValArray<LayoutState>) {
      this.$patch({ [args[0]]: args[1] });
    }
  }
});
